<?php include("src/addContract_cs.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />
<title>Adicionar Contrato :: ASSC</title>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>

<link rel="stylesheet" type="text/css" media="all" href="includes/calendario/calendar-system.css" title="system" />
<script type="text/javascript" src="includes/calendario/calendar.js"></script>
<script type="text/javascript" src="includes/calendario/lang/calendar-es.js"></script>
<script type="text/javascript" src="includes/calendario/calendar-setup.js"></script>
	<script type="text/javascript" src="js/ajax.js"></script>
	<script type="text/javascript" src="js/ajax-dynamic-list-company.js"></script>

<script language="javascript" type="text/javascript">
	
	var displayRow = '';
	if (navigator.appName == "Netscape")
		displayRow = 'table-row';
	else if (navigator.appName.indexOf("Explorer") != -1) 
		displayRow = 'block';
	
	var cont = 1;
	var maximum = 5
	function most(){
		document.getElementById("tr_phones").style.display = displayRow;
		if (cont < maximum ){
			cont++;
			$("#div_campo").append("<div id='div_tel_number_"+cont+"'>"+cont+". <input type='text' id='tel_number_"+cont+"' name='tel_number[]' class='text_grv' size='15' maxlength='14'/> <input type='text' id='tel_ext_"+cont+"' name='tel_ext[]' class='text_grv' size='3' maxlength='5'/></div>");
		}
		if(cont >0)
			document.getElementById('btnLess').disabled = 0;
	}
	
	function less(){
		if( cont == 2 )
			document.getElementById("tr_phones").style.display = 'none';
		
		if(cont > 1 ){
			$("#div_tel_number_"+cont).remove();
			cont--;
		}   
		if(cont == 1)
			document.getElementById('btnLess').disabled = 1;
	}
	
	function isMail(valor) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
			return (true);
		else
			return (false);
	}

	function validate(action){
		var code = document.getElementById('country_hidden').value;

		{	
	
			document.getElementById('div_company').innerHTML = code;
			document.getElementById('hdvc_code').value = code;

		}
		document.getElementById("action").value = action;//1: save, 2: save and continue.
		
		var msg = '';
		var hdvc_code 		= document.getElementById("hdvc_code").value;
		var hdv_code 		= document.getElementById("hdv_code").value;
		var cont_type  			= document.getElementById("cont_type").value;
		var cont_sal_periodo   		= document.getElementById("cont_sal_periodo").value;
		var cont_cargo  		= document.getElementById("cont_cargo").value;
			
		if(hdvc_code == '') 
			msg='- Por favor entre la compania. <br />';
			
		if(hdv_code == '') 
			msg='- Por favor entre el empleado. <br />';
		
		if(cont_type == '') 
			msg='- Por favor entre el tipo de contrato. <br />';
			
		if(cont_sal_periodo == '') 
			msg='- Por favor entre el periodo de pago de nomina. <br />';
			
		if(cont_cargo == '') 
			msg= msg+'- Por favor entre el cargo. <br />';
		
		if(msg==''){
			document.getElementById('form').submit();

			return true;
		}
		else{
			coolMessage("alert", msg);
			return false;
		}		
	}
	

	function onlyNumbers(e)
	{
	   var key;
	   if(window.event)
		  key = window.event.keyCode;   //IE
	   else
		  key = e.which;                //firefox
	   if (!( (key >= 48 && key <= 57) || key ==8 || key ==9 || key ==0 || key ==46 ))
		  return false;
	   else
		  return true;
	}	
	
</script>
<style type="text/css">
	
	/* START CSS NEEDED ONLY IN DEMO */

	#mainContainer{
		width:660px;
		margin:0 auto;
		text-align:left;
		height:100%;
		background-color:#FFF;
		border-left:3px double #000;
		border-right:3px double #000;
	}
	#formContent{
		padding:5px;
	}
	/* END CSS ONLY NEEDED IN DEMO */
	
	
	/* Big box with list of options */
	#ajax_listOfOptions{
		position:absolute;	/* Never change this one */
		width:175px;	/* Width of box */
		height:100px;	/* Height of box */
		overflow:auto;	/* Scrolling features */
		border:1px solid #317082;	/* Dark green border */
		background-color:#FFF;	/* White background color */
		text-align:left;
		font-size:14px;
		z-index:100;
	}
	#ajax_listOfOptions div{	/* General rule for both .optionDiv and .optionDivSelected */
		margin:1px;		
		padding:1px;
		cursor:pointer;
		font-size:12px;
	}
	#ajax_listOfOptions .optionDiv{	/* Div for each item in list */
		
	}
	#ajax_listOfOptions .optionDivSelected{ /* Selected item in the list */
		background-color:#317082;
		color:#FFF;
	}
	#ajax_listOfOptions_iframe{
		background-color:#F00;
		position:absolute;
		z-index:5;
	}
	
	form{
		display:inline;
	}
	
	</style>
</head>
<body>
<?php $item_select = 13;include("menu.php");?><br />
    <form name="form" id="form" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="addContract" id="addContract" value="1"/>
	<input type="hidden" name="action" id="action" value="1"/>
    <input type="hidden" name="hdvc_code" id="hdvc_code" />
    <input type="hidden" name="country_hidden" id="country_hidden" />
    
    <div class="content_grv">
		<table width="80%" align="center" class="shadow">
            <tr>
                <td class="title">Informacion Contrato Empleado Compania</td>
            </tr>
            <tr>
                <td>
                    <table class="tbl_form" align="center">
						<tr>
                            <td align="right"><span class="lbl_gray">Compania :</span></td>
                            <td><div id="div_company"></div></td>
                            <td><input type="text" id="country" name="country" value="" onkeyup="ajax_showOptions(this,'getCountriesByLetters',event)"  size="30" autocomplete="off" ></td>
        					<td align="left"></td>
                            <td><input type="hidden" name="country_hidden"  id="country_hidden" maxlength="20"    /></td>
                            
                        </tr>

                        <tr>
                            <td align="right"><span class="lbl_gray">Empleado:</span></td>
                            <td>&nbsp;</td>
                            <td><select name="hdv_code" id="hdv_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($employed);$i++) {?>
                                <option value="<?php echo $employed[$i]->hdv_code;?>"><?php echo $employed[$i]->hdv_name;?> <?php echo $employed[$i]->hdv_lastname;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Tipo Contrato:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td>
                            	<select name="cont_type" id="cont_type" class="text_grv">
                                    <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                    <option value="Indefinido">Indefinido</option>
                                    <option value="Temporal">Temporal</option>
                                    <option value="Temporal">Cooperativo</option>
                                    <option value="Temporal">Global</option>
                                    <option value="Temporal">Integral</option>
                                    <option value="Temporal">Servicios</option>
                                    <option value="Temporal">Tarea</option>
                                    <option value="Temporal">Inferior a un Ano</option>
                                    <option value="Temporal">3 Meses</option>
                            	</select>
                            </td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Valor Contrato:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="cont_value" id="cont_value" class="text_grv" size="31" maxlength="30" /></td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Periodo Pago Nomina:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td>
                            	<select name="cont_sal_periodo" id="cont_sal_periodo" class="text_grv">
                                    <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                    <option value="Quincenal">Quincenal</option>
                                    <option value="Mensual">Mensual</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Valor Salario:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="cont_sal_value" id="cont_sal_value" class="text_grv" size="31" maxlength="30" /></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Cargo:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="cont_cargo" id="cont_cargo" class="text_grv" size="41" maxlength="40"/></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Fecha de Ingreso:</span></td>
                            <td>&nbsp;</td>
                            <td><input name="cont_day_in" type="text" style="width:100px" readonly="readonly" id="cont_day_in" maxlength="45" class="text_grv"
				value="<?php if(isset($cont_day_in)) echo $cont_day_in?>"/>
			    <input name="imagea" type="image" id="calendar1" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td>
				<script type="text/javascript">
						Calendar.setup({
						inputField : "cont_day_in",							
						ifFormat : "%Y/%d/%m",
						showsTime : false,
						button : "calendar1", 
						step : 1
						});
				</script>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Fecha de Retiro:</span></td>
                            <td>&nbsp;</td>
                            <td><input name="cont_day_out" type="text" style="width:100px" readonly="readonly" id="cont_day_out" maxlength="45" class="text_grv"
				value="<?php if(isset($cont_day_out)) echo $cont_day_out?>"/>
			    <input name="imagea" type="image" id="calendar2" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td>
				<script type="text/javascript">
						Calendar.setup({
						inputField : "cont_day_out",							
						ifFormat : "%Y/%d/%m",
						showsTime : false,
						button : "calendar2", 
						step : 1
						});
				</script>
                        </tr>
                         <tr>
                            <td align="right"><span class="lbl_gray">Funeral:</span></td>
                            <td>&nbsp;</td>
                            <td>$ <input type="text" name="cont_funeral" id="cont_funeral" class="text_grv" size="21" maxlength="20"/></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Administracion:</span></td>
                            <td>&nbsp;</td>
                            <td>$ <input type="text" name="cont_admin" id="cont_admin" class="text_grv" size="21" maxlength="20"/></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Aporte Mutual:</span></td>
                            <td>&nbsp;</td>
                            <td>$ <input type="text" name="cont_aporte_mutual" id="cont_aporte_mutual" class="text_grv" size="21" maxlength="20"/></td>
                        </tr>
                      
                         <tr>
                            <td align="right"><span class="lbl_gray">Asesor:</span></td>
                            <td>&nbsp;</td>
                            <td><select name="ase_code" id="ase_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($asesor);$i++) {?>
                                <option value="<?php echo $asesor[$i]->ase_code;?>"><?php echo $asesor[$i]->ase_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Caja Compensacion :</span></td>
                            <td>&nbsp;</td>
                            <td><select name="para_code" id="para_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($parafiscal);$i++) {?>
                                <option value="<?php echo $parafiscal[$i]->para_code;?>"><?php echo $parafiscal[$i]->para_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>

                        <tr>
                            <td valign="top" align="right"><span class="lbl_gray">Descripcion:</span></td>
                            <td>&nbsp;</td>
                            <td><textarea name="cont_description" id="cont_description" class="text_grv" cols="40" rows="7"></textarea></td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">&nbsp;</td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">
                                <input type="button" class="button_grv" value="Save" onclick="javascript: return validate(1);" />
                                <input type="button" class="button_grv" value="Save and continue" onclick="javascript: return validate(2);" />
                                <input type="reset" value="Reset" class="button_grv_cancel"/>
                                <input type="button" class="button_grv_cancel" value="Cancel" onClick="javascript:window.location.href='listEmployed.php';" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
 	</div>
</form>    
</body>
</html>
<?php include('divscoolmessage.php');?>